Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve failure message of enum fromOrdinal/valueOf #19182

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

nicolasstucki
Copy link
Contributor

Fixes #19178

@@ -0,0 +1,4 @@
Failure(java.util.NoSuchElementException: enum Foo has no case with ordinal: 3)
Failure(java.lang.IllegalArgumentException: enum Foo has no case with name: Bar)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bishabosha why do those methods throw different exceptions? It seems that both could throw a NoSuchElementException.

Copy link
Member

@bishabosha bishabosha Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably compatibility with Java - it throws IllegalArgumentException for valueOf

@nicolasstucki nicolasstucki marked this pull request as ready for review December 5, 2023 10:13
@bishabosha bishabosha merged commit 1f7aa24 into scala:main Dec 15, 2023
19 checks passed
@bishabosha bishabosha deleted the fix-19178 branch December 15, 2023 19:06
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request Dec 18, 2023
Follow up of scala#19182. Using `fullName` causes the the `parallelBackend`
tests to loop forever.

Fixes scala#19285
Fixes scala#19281
Fixes scala#19278
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
WojciechMazur added a commit that referenced this pull request Jun 26, 2024
… LTS (#20802)

Backports #19182 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve enum fromOrdinal and valueOf error messages
3 participants